OrderByDescending(TSource, TKey) Method (ParallelQuery(TSource), Func(TSource, TKey), IComparer(TKey))

Task Parallel System.Threading

Sorts the elements of a sequence in descending order by using a specified comparer.

Namespace:  System.Linq
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function OrderByDescending(Of TSource, TKey) ( _
	source As ParallelQuery(Of TSource), _
	keySelector As Func(Of TSource, TKey), _
	comparer As IComparer(Of TKey) _
) As OrderedParallelQuery(Of TSource)
C#
public static OrderedParallelQuery<TSource> OrderByDescending<TSource, TKey>(
	ParallelQuery<TSource> source,
	Func<TSource, TKey> keySelector,
	IComparer<TKey> comparer
)

Parameters

source
Type: System.Linq..::.ParallelQuery<(Of <(TSource>)>)
A sequence of values to order.
keySelector
Type: System..::.Func<(Of <(TSource, TKey>)>)
A function to extract a key from an element.
comparer
Type: System.Collections.Generic..::.IComparer<(Of <(TKey>)>)
An IComparer{TKey} to compare keys.

Type Parameters

TSource
The type of elements of source.
TKey
The type of the key returned by keySelector.

Return Value

An OrderedParallelQuery{TSource} whose elements are sorted descending according to a key.

Remarks

In contrast to the sequential implementation, this is not a stable sort. See the remarks for OrderBy(ParallelQuery{TSource}, Func{TSource,TKey}) for an approach to implementing a stable sort.

Exceptions

ExceptionCondition
System..::.ArgumentNullException source or keySelector is a null reference (Nothing in Visual Basic).

See Also